<?php

/**********************************CUSTOMER CLASS******************************/

	//store data specific to the customer
	class testCustomer extends PHPUnit_Framework_TestCase {

	//public:

		//customer's table number
		public $rows;
		public $cost;
		public $position;
		public $calories;

		//what customer's eating/drinking
		public $drink; 
		public $plate;

		//constructor
		public function __construct() {
			$this->position = 1.1;
		} //conclude constructor
		
		//drinks customer's ordering
		public function testMeal() {
			global $appetizers; //make appetizers known
			$this->assertNull($appetizers);

			//collect all possible arguments
			$args = func_get_args();
			$this->assertEquals(0, count($args));

			//loop through each argument
			foreach($args as $values) 
				foreach($values as $index => $active) {
					switch($index) { //filter arguments
						case 'drink':
							$this->drink[$active] = $this->rows['drinks'][$active];
							$this->assertEquals($this->drink[$active], $this->rows['drinks'][$active]);

							$this->calories += $this->drink[$active]['calories'];
							$this->assertGreaterThanOrEqual($this->drink[$active]['calories'], $this->calories);

							$this->cost += $this->drink[$active]['cost'];
							$this->assertGreaterThanOrEqual($this->drink[$active]['cost'], $this->cost);
							break;
						case 'plate':
							$this->plate[$active] = $appetizers[$active];
							$this->assertEquals($this->plate[$active], $appetizers[$active]);

							$this->calories += $this->plate[$active]->get_calories();
							$this->assertGreaterThanOrEqual($this->plate[$active]->get_calories(), $this->calories);

							$this->cost += $this->plate[$active]->get_cost();
							$this->assertGreaterThanOrEqual($this->plate[$active]->get_cost(), $this->cost);
							break;
					} //end switch
				} //end loop
		} //concludes meals 

                // assign plates
                public function testPlate(){
                   $this->cost += 12.75;
		   $this->assertGreaterThanOrEqual(12.75, $this->cost);

                   $this->calories += 100;
		   $this->assertGreaterThanOrEqual(100, $this->calories);
                } // conclude plates

		//show current customer information
		public function testOutput() {
			$str = "$this->position\n";
			$this->assertSame($str, "$this->position\n");

			$str .= "$this->calories\n";
			$this->assertSame($str, "$this->position\n" . "$this->calories\n");

			$str .= "$this->cost\n";
			$this->assertSame($str, "$this->position\n" . "$this->calories\n" . "$this->cost\n");

			$str .= print_r($this->drink,true);
			$this->assertSame($str, "$this->position\n" . "$this->calories\n" . "$this->cost\n" . "$this->drink");

			$str .= print_r($this->plate,true);
			$this->assertSame($str, "$this->position\n" . "$this->calories\n" . "$this->cost\n" . "$this->drink" . "$this->plate");
                        return $str;
		} //end output function
	} //conclude class
?>
